﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Xml.Linq;
using System.Web.Routing;
using System.Web.DynamicData;

namespace Pap.Historical.Web
{
    public class Global : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            //MetaModel modelHistory = new MetaModel();
            //modelHistory.RegisterContext(typeof(HistoricalLoansDataContext), new ContextConfiguration() { ScaffoldAllTables = true });
            //routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
            //{
            //    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
            //    Model = modelHistory
            //});



            MetaModel modelRunning = new MetaModel();
            modelRunning.RegisterContext(typeof(RunningLoansDataContext), new ContextConfiguration() { ScaffoldAllTables = true });
            routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = modelRunning
            });

            
        }

        void Application_Start(object sender, EventArgs e)
        {
            RegisterRoutes(RouteTable.Routes);
        }

    }
}
